<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/view/inc.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
<div style="padding: 20px;">
    <form method="post" class="form" id="form" action ="<%=contextPath%>/sys/role/resource/saveAndUpdate">
        <input  type="hidden" name="roleId" value="${role.id}"/>
        <input id="resourceIds" type="hidden" name="resourceIds"/>

        <div style="padding:10px;">角色名称：${role.roleName}
        </div>
        <div style="padding:10px;">
            <div >
                <a href="#" class="easyui-linkbutton" onclick="checkAllTree('treeId')">全选</a>
                <a href="#" class="easyui-linkbutton" onclick="unCheckAllTree('treeId')">取消</a>
            </div>
            <div style="padding-top: 10px;">
                <ul id="treeId" class="easyui-tree"
                    data-options="url:'<%=contextPath%>/sys/resource/commonTreeByRoleId?roleId=${role.id}',method:'get',animate:true,checkbox:true,parentField:'parentId'"></ul>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    $(function () {
        $('#treeId').tree({
            cascadeCheck: $(this).is(':checked')
        });
    })
    function sy_customerFun() {
       /* console.info("test");*/
        var nodes = $('#treeId').tree('getChecked');
        var s = '';
        for (var i = 0; i < nodes.length; i++) {
            if (s != '') s += ',';
            s += nodes[i].id;
        }
       $("#resourceIds").val(s);
    }
</script>
</body>
</html>